﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-BR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Criando Tabela com JavaScript</title>

<script type="text/javascript">

var linha = prompt("Digite o número de linhas de sua tabela","");
var coluna = prompt("Digite o número de colunas de sua tabela","");

document.write("<table>");

for(var i=1 ; i <= linha ; i++){
	document.write("<tr>");
	
	for(var j=1 ; j<= coluna ; j++){
		
		var valor = i*j;
		
		
		if(valor%2==0){
			document.write('<td style="background-color:#f00;">' + valor + '</td>');
		}else{
			document.write('<td style="background-color:#0f0;">' + valor + '</td>');
		}
	}
	document.write("</tr>");
}



document.write("</table>");


</script>
</head>

<body>

</body>

</html>

